<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>定位</title>
		<style type="text/css">
			div{
				width: 200px;
				height: 200px;
				/*margin-top: 20px;*/
			}
			/*relative:相对定位,相对元素原先的位置移动,不脱标!*/
			.box-one{
				position: relative;
				top: 50px;
				left: 50px;
				background-color: pink;
			}
			.box-two{
				position: relative;
				top: 100px;
				left: 50px;
				border: solid 5px red;
			}
			/*absulate:绝对定位,相对于上一级定位元素来移动位置,往上找不到定位元素就按body来移动.脱标!*/
			.box-three{
				position: absolute;
				top: 10px;
				width: 50px;
				height: 50px;
				background-color: deeppink;
			}
			.box-four{
				position: absolute;
				top: 70px;
				width: 50px;
				height: 50px;
				background-color: hotpink;
			}
		</style>
	</head>
	<body>
		<div class="box-one"></div>
		<div class="box-two">
			<div class="box-three"></div>
			<div class="box-four"></div>
		</div>
	</body>
</html>
